<template>
  <el-dialog v-model="visible" :title="'详情'" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form :model="dataForm" :rules="rules" ref="dataFormRef" @keyup.enter="dataFormSubmitHandle()" label-width="120px" disabled="true">
<!--          <el-form-item label="关联的采购项目" prop="purchaseProjectId">-->
<!--        <el-input v-model="dataForm.purchaseProjectId" placeholder=""></el-input>-->
<!--      </el-form-item>-->
          <el-form-item label="竞价开始时间" prop="biddingStartTime">
        <el-input v-model="dataForm.biddingStartTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="竞价结束时间" prop="biddingEndTime">
        <el-input v-model="dataForm.biddingEndTime" placeholder=""></el-input>
      </el-form-item>
      <el-form-item label="是否启用" prop="status">
        <ren-radio-group v-model="dataForm.status" dict-type="is_or_no"></ren-radio-group>
      </el-form-item>
          <el-form-item label="是否多次竞价" prop="isManyBidding">
            <ren-radio-group v-model="dataForm.isManyBidding" dict-type="is_or_no"></ren-radio-group>
      </el-form-item>
          <el-form-item label="是否设置降价幅度" prop="isCutPriceRange">
            <ren-radio-group v-model="dataForm.isCutPriceRange" dict-type="is_or_no"></ren-radio-group>
      </el-form-item>
          <el-form-item label="降价幅度(元)" prop="cutPriceRange">
        <el-input v-model="dataForm.cutPriceRange" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="是否延迟报价" prop="isDelayOffer">
            <ren-radio-group v-model="dataForm.isDelayOffer" dict-type="is_or_no"></ren-radio-group>
      </el-form-item>
          <el-form-item label="延迟时间(分钟)" prop="delayTime">
        <el-input v-model="dataForm.delayTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="延迟次数" prop="delayNumber">
        <el-input v-model="dataForm.delayNumber" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建人" prop="createUser">
        <el-input v-model="dataForm.createUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="项目创建时间" prop="createTime">
        <el-input v-model="dataForm.createTime" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新人" prop="updateUser">
        <el-input v-model="dataForm.updateUser" placeholder=""></el-input>
      </el-form-item>
          <el-form-item label="最后更新时间" prop="updateTime">
        <el-input v-model="dataForm.updateTime" placeholder=""></el-input>
      </el-form-item>
      </el-form>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import baseService from "@/service/baseService";
import { ElMessage } from "element-plus";
const emit = defineEmits(["refreshDataList"]);

const visible = ref(false);
const dataFormRef = ref();

const dataForm = reactive({
  biddingRuleId: '',  purchaseProjectId: '',  biddingStartTime: '',  biddingEndTime: '',  isManyBidding: '',  isCutPriceRange: '',  cutPriceRange: '',  isDelayOffer: '',  delayTime: '',  delayNumber: '',  createUser: '',  createTime: '',  updateUser: '',  updateTime: ''});

const init = (biddingRuleId?: number) => {
  visible.value = true;
  dataForm.biddingRuleId = "";

  if (biddingRuleId) {
    getInfo(biddingRuleId);
  }
};

// 获取信息
const getInfo = (biddingRuleId: number) => {
  baseService.get("/biddingrule/biddingrule/" + biddingRuleId).then((res) => {
    Object.assign(dataForm, res.data);
  });
};

defineExpose({
  init
});
</script>
